/*************************************************************************
	> File Name: 5.E.cpp
	> Author: hug
	> Mail: hug@haizeix.com
	> Created Time: 日  1/26 18:36:35 2025
 ************************************************************************/

#include <iostream>
using namespace std;

#define int long long

int n, m;
int check_cnt, check_cost;
int p[200005];

bool check(int x) {
    check_cnt = 0;
    check_cost = 0;
    for (int i = 1; i <= n; i++) {
        if (p[i] > x) continue;
        int k = (x / p[i] + 1) / 2;
        if (p[i] > (m - check_cost) / k / k) return false;
        check_cost += k * k * p[i];
        check_cnt += k;
    }
    return true;
}

int erfen() {
    int l = 1, r = m + 1, mid;
    while (l < r) {
        mid = (l + r) / 2;
        if (check(mid)) l = mid + 1;
        else r = mid;
    }
    check(l - 1);
    check_cnt += (m - check_cost) / l;
    return check_cnt;
}

int32_t main() {
    cin >> n >> m;
    for (int i = 1; i <= n; i++) cin >> p[i];
    cout << erfen() << endl;
    return 0;
}
